/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToOne;
import type.Month;

/**
 *
 * @author wei
 */
@Entity(name="RawMaterialRequirementWeekly")
public class RawMaterialRequirementWeeklyEntity extends DataObjectEntity implements Serializable {
    private int yearOfProduction;
    private int weekOfProduction;
    private Month monthOfProduction;
    private long mrpReservation =0;
    
    @OneToOne
    private MasterProductionScheduleWeeklyEntity classicMpsWeekly;
    
    @OneToOne
    private MasterProductionScheduleWeeklyEntity premiumMpsWeekly;
    
    @OneToOne
    private RawMaterialEntity rawMaterial;
    private long grossRequirement =0; //calculated from mpsWeekly and BoM
    @OneToOne(cascade={CascadeType.PERSIST})
    private RawMaterialPurchaseOrderReportEntity scheduledReceipt;
    private long plannedReceipt=0;
    private long onHandQuantity=0;
    private long plannedOrderQuantity=0;
    private boolean isLastWeek = false;

    public RawMaterialRequirementWeeklyEntity() {
        super();
    }
    
    public boolean getIsLastWeek(){
        return isLastWeek;
    }
    
    public void setIsLastWeek(boolean isLastWeek){
        this.isLastWeek = isLastWeek;
    }
    
    public long getMrpReservation(){
        return mrpReservation;
    }
    
    public void setMrpReservation(long number){
        mrpReservation = number;
    }
    
    public long getPlannedReceipt(){
        return plannedReceipt;
    }
    
    public void setPlannedReceipt(long plannedReceipt){
        this.plannedReceipt = plannedReceipt;
    }
    
    public Month getMonthOfProduction(){
        return monthOfProduction;
    }
    
    public void setMonthOfProduction(Month month){
        monthOfProduction = month;
    }
    
    
    public long getGrossRequirement() {
        return grossRequirement;
    }

    public void setGrossRequirement(long grossRequirement) {
        this.grossRequirement = grossRequirement;
    }

    public MasterProductionScheduleWeeklyEntity getClassicMpsWeekly() {
        return classicMpsWeekly;
    }

    public void setClassicMpsWeekly(MasterProductionScheduleWeeklyEntity mpsWeekly) {
        this.classicMpsWeekly = mpsWeekly;
    }
    
    public MasterProductionScheduleWeeklyEntity getPremiumMpsWeekly() {
        return premiumMpsWeekly;
    }

    public void setPremiumMpsWeekly(MasterProductionScheduleWeeklyEntity mpsWeekly) {
        this.premiumMpsWeekly = mpsWeekly;
    }

    public long getOnHandQuantity() {
        return onHandQuantity;
    }

    public void setOnHandQuantity(long onHandQuantiy) {
        this.onHandQuantity = onHandQuantiy;
    }

    public long getPlannedOrderQuantity() {
        return plannedOrderQuantity;
    }

    public void setPlannedOrderQuantity(long plannedOrderQuantity) {
        this.plannedOrderQuantity = plannedOrderQuantity;
    }

    public RawMaterialEntity getRawMaterial() {
        return rawMaterial;
    }

    public void setRawMaterial(RawMaterialEntity rawMaterial) {
        this.rawMaterial = rawMaterial;
    }

    public RawMaterialPurchaseOrderReportEntity getScheduledReceipt() {
        return scheduledReceipt;
    }

    public void setScheduledReceipt(RawMaterialPurchaseOrderReportEntity scheduledReceipt) {
        this.scheduledReceipt = scheduledReceipt;
    }

    public int getWeekOfProduction() {
        return weekOfProduction;
    }

    public void setWeekOfProduction(int weekOfProduction) {
        this.weekOfProduction = weekOfProduction;
    }

    public int getYearOfProduction() {
        return yearOfProduction;
    }

    public void setYearOfProduction(int yearOfProduction) {
        this.yearOfProduction = yearOfProduction;
    }

    @Override
    public String childToString() {
        return "RawMaterialRequirementWeeklyEntity{" + "yearOfProduction=" + yearOfProduction + ", weekOfProduction=" + weekOfProduction + ", classMpsWeekly=" + classicMpsWeekly + ", rawMaterial=" + rawMaterial + ", grossRequirement=" + grossRequirement + ", scheduledReceipt=" + scheduledReceipt + ", onHandQuantity=" + onHandQuantity + ", plannedOrderQuantity=" + plannedOrderQuantity + '}';
    }
    
}
